package gui;

import com.thirdnf.ResourceScheduler.Appointment;
import com.thirdnf.ResourceScheduler.components.AbstractAppointmentComponent;
import com.thirdnf.ResourceScheduler.components.BasicComponentFactory;


/**
 * Represente la fabrication de composants pour creer des evenements personalises
 * @author Stanislas KOBAK / Celine BARILLERE
 *
 */
public class ComponentFactory extends BasicComponentFactory
{
    private AppointmentListener appointmentListener;

    @Override
    public AbstractAppointmentComponent makeAppointmentComponent(Appointment appointment)
    {
        AppointmentComponent component = new AppointmentComponent(appointment);
        component.setAppointmentListener(appointmentListener);

        return component;
    }


    /**
     * Set the appointment listener.  This will be passed into every appointment component which
     * is created.
     *
     * @param appointmentListener (not null) The listener to call for mouse clicks on the appointments.
     */
    public void setAppointmentListener(AppointmentListener appointmentListener)
    {
        this.appointmentListener = appointmentListener;
    }
}
